﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace ConnectFour
{
    abstract class Player
    {
        protected readonly Checker myColor;
        private readonly Checker opponentChecker;
        protected readonly Board board;
        protected readonly String myDirectory;

        public Checker Checker {
            get { return myColor; }
        }

        public Checker OpponentChecker
        {
            get { return opponentChecker; }
        }

        public Board Board
        {
            get { return board; }
        }

        /// <summary>
        /// Constructor for Player
        /// </summary>
        /// <param name="myColor">The Checker color this player uses</param>
        /// <param name="board">Reference to the board object</param>
        /// <param name="myDirectory">Directory name that should be used if files are used.</param>
        public Player(Checker myColor, Board board, String myDirectory)
        {
            this.myColor = myColor;
            this.opponentChecker = myColor == Checker.Red ? Checker.Black : Checker.Red;
            this.board = board;
            this.myDirectory = myDirectory;
        }

        /// <summary>
        /// Informs the player that the game has ended and specifies which color won
        /// </summary>
        /// <param name="winner">The winning checker color</param>
        public abstract void GameOver(Checker winner);

        /// <summary>
        /// Asks the player for its next move on the board. The move made by the previous player is provided for convenience
        /// </summary>
        /// <param name="lastMove">The previous move made</param>
        /// <returns>0-biased integer indicating which column to play in</returns>
        public abstract int Move(int lastMove);

    }
}
